<template>
    <div class="standard-table">
        <query-form :show-finish="true"></query-form>
        <div class="h-line"></div>
        <div class="table">
            <Table highlight-row :stripe="false" ref="table" :columns="tableHeader" :data="tableData"></Table>
        </div>
        <pagination :total="total" @change="pageChange"></pagination>
    </div>
</template>

<script>
    import pagination from 'components/commons/pagination'; //分页
    import QueryForm from './QueryForm';  // 查询表单
    export default {
        components: { pagination, QueryForm },
        data(){
            return {
                tableHeader: [
                    { type: 'index', width: 60, align: 'center', title: '序号' },
                    { title: '维修结算单名称', key: 'statementNo' },
                    { title: '上传时间', key: 'updated' },
                    { title: '标准化完成时间', key: 'updated' }
                ],
                tableData: [],
                queryParams: {
                    startdate: '',
                    enddate: '',
                    source: 2,
                    xlsxStatus: 1,
                    xlsxPath: 1,
                    statusFix: 2,
                    rows: 10,
                    page: 1
                },
                total: 0
            }
        },
        mounted(){
            // this.init();
        },
        methods: {
            init(){
                if(this.tableData.length !== 0) return;
                this.queryParams.id = '58d8712495596d68f52e5b5a';
                this.getTableData();
            },
            pageChange(params){
                this.queryParams = Object.assign(this.queryParams, params);
                this.getTableData();
            },
            getTableData(){
                this.$ajax(this.$api.statement.maintenaceList, this.queryParams, success => {
                    this.tableData = success.rows;
                    this.total = success.total;
                })
            }
        }
    }
</script>

<style lang="less">
    .standar-table{

    }
</style>
